package org.webshop.backend.dbchif.sql;

//import static org.webshop.backend.database.sql.DBAccessSql.*;

import java.util.HashMap;

public class StatementStore {

    private HashMap<Integer, RawStatement> statementMap;

    private static StatementStore instance;

    public static StatementStore getInstance() {
        if (instance == null) {
            synchronized (StatementStore.class) {
                if (instance == null) {
                    instance = new StatementStore();
                }
            }
        }
        return instance;
    }

    private StatementStore() {
        statementMap = new HashMap<Integer, RawStatement>();
        //
        DbAccessStatement[] statements = DbAccessStatement.values();
        for (int i = 0; i < statements.length; i++) {
            DbAccessStatement statement = statements[i];
            statementMap.put(statement.getIdentifier(), statement);
        }
    }

    public RawStatement getStatement(Integer key) {
        return statementMap.get(key);
    }
}
